package com.ojoin.trade.supplyloan_core.web.service;

import java.io.OutputStream;
import java.util.List;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.supplyloan_core.web.domain.*;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 15-10-30
 * Time: 上午11:36
 * To change this template use File | Settings | File Templates.
 */
public interface TbSlLoanService {


    /**
     * 获取当前用户可提额度
     * @param joinid
     * @param type
     * @return
     * @throws BusinessException
     */
    public String getMaxLoanAmount(int joinid,String type)throws BusinessException;



    /**
     * 初审通过
     * @param id
     * @param idofcompany
     * @throws BusinessException
     */
    public void updateForfirsttrialSuccess(int id, int idofcompany, String ts,String loanVoucher,String paymentNotice,int joinid,String contract,String loanregist)throws BusinessException;

    /**
     * 初审不通过
     * @param id
     * @param idofcompany
     * @param memo
     * @throws BusinessException
     */
    public void updateForRefuseLoan(int id, int idofcompany, String memo, String ts)throws BusinessException;

    /**
     * 真正放款
     * @param id

     * @param mhtnofrom
     * @param payPasswd
     * @throws BusinessException
     */

    public void updateForRealLoan(int id,int idOfTbFactoryingOperator, String mhtnofrom, String payPasswd,Integer idofLoanInfo,String ts,String tsOfLoanInfo,String voucher,String taskid, String processid)throws BusinessException;


    public void updateForRedoRealLoan(int id,int idOfTbFactoryingOperator, String mhtnofrom,Integer idofLoanInfo,String ts,String tsOfLoanInfo,String voucher,String applydate,String orderid,String taskid,String processid)throws BusinessException;
    /**手动还款
     * @param joinid
     * @param listvo
     * @param loaninfovo
     * @param pwd
     * @param accamount
     * @return 
     * @throws BusinessException
     */

    public Long updateForRepayLoan(int joinid,List<TbSlNotPayBackCredit> listvo,TbSlLoanInfo loaninfovo,String pwd,String accamount, String repayAcccountType)throws BusinessException;

    public void updateForReDoRepayLoan(int joinid,List<TbSlNotPayBackCredit> listvo,TbSlLoanInfo loaninfovo,String accamount,String applydate,String repayAcccountType, String orderId)throws BusinessException;

    /**
     * 自动还款
     * @throws BusinessException
     */

    public void execAutomaticRepayLoan(String type)throws BusinessException;

    /**
     * 给指定的商户号还款
     * @param amount
     * @param joinid
     * @throws BusinessException
     */
    public void updateForAutoRepayLoanByJoinid(long amount, int joinid, String idofpaynow,String pwd,TbSlRefundForFrontVo vo)throws  BusinessException;

    public void updateForRedoAutoRepayLoanByJoinid(long amount, int joinid,TbSlRefundForFrontVo vo,String orderid,String applydate)throws  BusinessException;

    /**保理员后台的放款
     *@param amount
     * @param joinid
     * @param idofpaynow
     * @param ventor
     * @param vo
     * @throws BusinessException
     */
    public void updateForAutoRepayForOperator(long amount,int joinid,String idofpaynow,String ventor,TbSlRefundForFrontVo vo)throws BusinessException;
    /**
     *  指定商户从金融户还款
     *
     * @param joinid
     * @param idofpaynow
     * @throws BusinessException
     */
    public void updateForRepayLoanByJoinid(long amount,int joinid, String idofpaynow,String type)throws  BusinessException;

    public void updateForRedoRepayLoanByJoinid(long amount,int joinid,String applydate,String orderid)throws  BusinessException;
    /**
     * 自动还款一笔一笔还款
     * @param creditLog
     * @param appvo
     * @param amount
     * @param joinid
     * @return
     * @throws BusinessException
     */
    public long updateRepayOneByOneLoan(TbSlLoanCreditLog creditLog, TbSlLoanApplication appvo, long amount, int joinid, String order_id,TbSlLoanInfo loanInfo,String ventor,String applydate)throws BusinessException;

    /**
     * 手动还款一笔笔还款
     * @param creditLog
     * @param joinid
     * @throws BusinessException
     */
    public long updateRepayOneByManial(TbSlLoanInfo loanInfo,TbSlLoanCreditLog creditLog, int joinid, String order_id,String applydate)throws BusinessException;


    public void queryFinanceInfo()throws BusinessException;

    /**
     * 申请贷款
     * @param amount
     * @param joinid
     * @param idofpaynow
     * @throws BusinessException
     */
    public  List<TbSlLoanCreditLog> updateForReLoan(long amount, int joinid, String idofpaynow,TbSlLoanCreditVoForFront vo,Integer bankacc)throws BusinessException;

    /**
     * 自动匹配生成贷款数据
     * @param amount
     * @param joinid
     * @param idofpaynow
     * @return
     * @throws BusinessException
     */
    public List<TbSlLoanCreditLog> autoGenerationCredit(long amount,int joinid,String idofpaynow,String type)throws BusinessException;

    /**
     * 自动匹配生成还款数据
     * @param amount
     * @param joinid
     * @param idofpaynow
     * @return
     * @throws BusinessException
     */
    public TbSlRefundForFrontVo autoGenerationRefund(long amount,int joinid,String idofpaynow,String type)throws BusinessException;

    /**
     * 自动匹配提款的数据
     * @param amount
     * @param joinid
     * @param idofpaynow
     * @return
     * @throws BusinessException
     */
    public TbSlLoanCreditVoForFront queryPreLoan(long amount,int joinid,String idofpaynow,String type)throws BusinessException;

    /**给商户提供的平台明细的接口
     *   * @param joinid
     * @return
     * @throws BusinessException
     */

    public List<TbSlPlatformUserWithdrawVO> queryPlatformDetail(int joinid)throws BusinessException;

    /**
     *给保理员提供的查看商户明细的接口
     * @param joinid
     * @return
     * @throws BusinessException
     */
    public List<TbSlPlatformUserWithdrawVO> queryPlatformDetailForOperator(int joinid)throws BusinessException;

    /**后台保理员补录贷款记录
     *param amount
     * @param joinid
     * @param idofpaynow
     * @param vo
     * @param idOfTbFactoryingOperator
     * @param mhtnofrom
     * @param voucher
     * @throws BusinessException
     */
    public void updateForSlApplyLoan(long amount, int joinid, String idofpaynow,TbSlLoanCreditVoForFront vo,int idOfTbFactoryingOperator, String mhtnofrom,String voucher,int idOfTbFactoryingCompany)throws BusinessException;

    /**
     * 导出指定用户的融资对账表文件
     * @param joinuserid
     * @throws BusinessException
     */
    public void exportSLLoanReportExcelFile(int joinuserid, OutputStream outputStream) throws BusinessException;

    /**展期申请
     ** @param id
     * @param rowUpdateTime
     * @param renewedUpload
     * @throws BusinessException
     */
    public void updateforapplyRenewed(Integer id,String rowUpdateTime,String renewedUpload)throws BusinessException;

    /**同意展期申请
     *@param vo
     * @throws BusinessException
     */
    public void updateForAgreeRenewed(SlCreditRenewedVo vo)throws BusinessException;

    /**拒绝展期申请
     ** @param id
     * @param rowupdatetime
     * @param memo
     * @throws BusinessException
     */
    public void updateRefuseRenewed(Integer id,String rowupdatetime,String memo)throws BusinessException;

    /**新增调价信息
     ** @param vo
     * @throws BusinessException
     */
    public void updateLoanFloat(TbSlCreditForFloatVo vo)throws BusinessException;

    public List<TbSlPlatformUserWithdrawVO> queryCanLoadByFirstTrail(int joinid)throws BusinessException;

    /**
     * 生成合同信息核查表
     * @param joinuserid
     * @param outputStream
     * @throws BusinessException
     */
    public void exportSLContractInfoCheckExl(int joinuserid, OutputStream outputStream) throws BusinessException;

    public void updateForCancelCreditInfo(Integer processid)throws BusinessException;

    public void updateForUploadFile(Integer processid,String ts,String filepath)throws BusinessException;

    public void updateForRejectCredit(Integer processid)throws BusinessException;

    public void updateForRefuseCredit(Integer processid,String memo,String ts)throws BusinessException;

    public void updateRechargeAccount(Integer id,String msg)throws BusinessException;

    public void updateForDealRedoWithFailure(String orderId,String msg)throws BusinessException;
    
    /**
     * 导出融资日报文件
     * @throws BusinessException
     */
    public void exportSLDailyLoanFile(String curdate, Integer idOfTbMerchantUser, Integer joinuserid, OutputStream outputStream) throws BusinessException;

    /**
     * 手动部分还款
     * @param mhtNo
     * @param refundAmount
     * @param paypwd
     * @throws BusinessException
     */
    public void manualPartRefund(int joinid,List<TbSlNotPayBackCredit> listvo,TbSlLoanInfo loaninfovo,String pwd,String accamount, String repayAcccountType)
			throws BusinessException;
}